import numpy as np
import matplotlib.pyplot as plt
import pandas as pd


dataframe = pd.read_csv("train_data.csv")

X= dataframe[['x1', 'x2']].values
labels = dataframe['y'].values

unique_lables=set(labels)
colors = plt.cm.Spectral(np.linspace(0,1,len(unique_lables)))
for k,col in zip(unique_lables,colors):
    x_k = X[labels==k]
    plt.plot(x_k[:,0],x_k[:,1],'o',markerfacecolor=col,markeredgecolor="k",
             markersize=14)


plt.title('data by make_classification()')

#################################################################

#绘制逻辑回归结果的直线
#其中weight和b的数据来源于逻辑回归算法训练之后的结果
weight = [0.45688252, 0.45688252]
b = -0.7686426869590841

x = np.arange(-3.0, 5.0, 0.1)
y = (-weight[0] - weight[1] * x) / b
plt.plot(x, y, color = 'g')

#################################################################


plt.show()